<?php

/*
 * author: wiloke
 * author uri: wiloke.com
 * date: 04/24/2014
 * time: 03 AM
 */



if ( !class_exists('qvaCore') )
{

    class qvaCore
    {
        private  static $_self;
        public static $qvaOptions;

        public static function qva_automaticallyThis($aDefaults)
        {
            if (!self::$_self)
            {
                $init = new self($aDefaults);
            }
        }   

        public $adefConfigs;

        public function __construct($configs)
        {
            $this->adefConfigs = $configs;
            /*
             * Flush rewrite rule
             */
            add_action('after_switch_theme', array($this, 'qva_flush_rewrite_rules'));


            /*
             * Register Post Type
             * @reference https://codex.wordpress.org/Function_Reference/register_post_type
             */
            add_action('init', array($this, 'qva_register_post_type'));


            /*
             * Register admin css and jquery
             */
            add_action('admin_enqueue_scripts', array($this, 'qva_enqueue_scripts'));

            /*
             * regiset post type
             */
            add_action('edit_form_after_title', array($this, 'qva_edit_form_after_title'));

            /*
             * Add table fa to footer
             */
            add_action('in_admin_footer', array($this, 'qva_add_table_fa'));


            /*
             * Save Posts
             */
            add_action('save_post', array($this, 'qva_save_posts'));


            /*
             * Frontend loading js css
             */
            add_action('wp_enqueue_scripts', array($this, 'qva_fe_enqueue_scripts'));


            /*
             * Filter Gallery Shortcode
             * @reference http://wiloke.com/filter-gallery-shortcode-wordpress/
             */
            add_filter('post_gallery', array($this, 'qva_filter_for_gallery_shortcode'), 10, 2);

            /*
             * Custom attachment fields
             */
            add_filter( 'attachment_fields_to_edit', array($this,  'qva_custom_attachment_fields'), 10, 2 );


            /*
             * Insert Custom field Data
             */
            add_filter('attachment_fields_to_save', array($this, 'qva_insert_custom_field_data'), 10, 2);

            //add_action('init', array($this, 'test'));

            // will be displayed settings before editor
            add_action('edit_form_after_title', array($this, 'qva_add_options'));


            

            // widget
            add_action('init', array($this, 'qva_create_sidebar'));

            /*
             *  Filter Selected gallery comlumn
             */
            // add_filter('post_gallery', array($this, 'qva_override_gallery_column'), 1, 2);

            // add_action('init', array($this, 'qva_get_options'), 100);
            self::$qvaOptions = get_option("qva_save_theme_options");
           
            self::$qvaOptions = isset(self::$qvaOptions['theme_options']) && !empty(self::$qvaOptions['theme_options']) ? self::$qvaOptions['theme_options'] : array();
        
            add_action('wp_ajax_qva-tweets-mod', array($this, 'qva_latest_tweets'));
            add_action('wp_ajax_nopriv_qva-tweets-mod', array($this, 'qva_latest_tweets'));


            // submenu
            add_action('admin_menu', array($this, 'qva_create_import_demo'));

            /*Import Demo Data*/
            add_action('wp_ajax_wiloke-import', array($this, "qva_import_demo_data"));

            /* Add Metaboxes */
            add_action( 'add_meta_boxes', array($this,'adding_custom_meta_boxes'), 10, 2 );

            // add_action('init', array($this, 'testx'));

            /* Filter the title */
            add_filter('enter_title_here', array($this, 'custom_enter_title') );

        }

        public function custom_enter_title($title)
        {
            $screen = get_current_screen();
            include (QVA_ADMIN_MD . 'custom-enter-title/custom-enter-title.php');
        }

        public function testx()
        {
            $meta  = set_theme_mod('nav_menu_locations', '');
            $meta = wp_get_nav_menus();
            var_dump($meta);
        }

        public function adding_custom_meta_boxes()
        {
            add_meta_box( 
                'qva-ourservices',
                __( 'Our Services', QVA_LANG ),
                array($this, 'qva_render_ourservices'),
                'qva_ourservice',
                'normal',
                'default'
            );

            add_meta_box( 
                'qva-ourservices-slogan',
                __( 'Slogan', QVA_LANG ),
                array($this, 'qva_render_ourservices_slogan'),
                'qva_ourservice',
                'normal',
                'default'
            );

            add_meta_box( 
                'qva-aboutus',
                __( 'About', QVA_LANG ),
                array($this, 'qva_render_about'),
                'qva_aboutus',
                'normal',
                'default'
            );

            add_meta_box( 
                'qva-somefacts',
                __( 'Some facts', QVA_LANG ),
                array($this, 'qva_render_somefacts'),
                'qva_aboutus',
                'normal',
                'default'
            );

            add_meta_box( 
                'qva-ourclients',
                __( 'Tesimonials', QVA_LANG ),
                array($this, 'qva_render_testimonials'),
                'qva_ourclients',
                'normal',
                'default'
            );

            add_meta_box( 
                'qva-weworkingwith',
                __( 'We Have Work With', QVA_LANG ),
                array($this, 'qva_render_weworkingwith'),
                'qva_ourclients',
                'normal',
                'default'
            );
        }

        public function qva_render_ourservices($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/ourservice/ourservice.php');
        }

        public function qva_render_ourservices_slogan($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/ourservice/slogan.php');
        }

        public function qva_render_about($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/aboutus/aboutus.php');
        }

        public function qva_render_somefacts($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/aboutus/somefact.php');
        }

        public function qva_render_testimonials($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/ourclients/testimonial.php');
        }

        public function qva_render_weworkingwith($post)
        {
            // global $post;
            include (QVA_ADMIN_DIR . '/modules/metaboxes/ourclients/weworkingwith.php');
        }


        public function qva_create_import_demo()
        {
            if ( is_plugin_active('qva-options/qva-options.php') ) :
                add_submenu_page('qva-options', 'Import Demo', 'Import Demo', 'edit_theme_options', 'import-demo-qva', array($this, 'qva_setting_demo'));    
            endif;
        }

        public function qva_intergrate_update()
        {
            include ( dirname(__FILE__) . '/modules/update/update.php');
        }


        public function qva_setting_demo()
        {
            include ( dirname(__FILE__) . '/modules/import-demo/demo-builder.php');
        }

        public function qva_import_demo_data()
        {
            if ( check_ajax_referer('wo-nonce', '_wp_nonce') && isset($_REQUEST['_wp_http_referer']) &&  preg_match("/page=import-demo-qva/i",$_REQUEST['_wp_http_referer']) )
            {
            if ( !defined('WP_LOAD_IMPORTERS') ) define('WP_LOAD_IMPORTERS', true);
                require_once ABSPATH . 'wp-admin/includes/import.php';
            $importer_error = false;
            if ( !class_exists( 'WP_Importer' ) ) {
                $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
                if ( file_exists( $class_wp_importer ) ){
                    require_once($class_wp_importer);
                }
                else{
                    $importer_error = true;
                }
            }

            // if ( !file_exists(BO_CONS . 'theme_options.php') )
            // {
            //     die("theme-options");
            // }else{
            //     include (BO_CONS . 'theme_options.php');
            //     if (empty($data)) die("empty data");
            //     $aOptions = unserialize($data);
            // }

            if ( !class_exists( 'WP_Import' ) ) {
                $class_wp_import = QVA_ADMIN_LIBS . 'wp-importer/class.wp-importer.php';
                if ( file_exists( $class_wp_import ) )
                    require_once($class_wp_import);
                else
                    $importerError = true;
            }

            if($importer_error){
                echo "<div class=\"alert-box alert-error\"><strong>Error!</strong> The Auto importing script could not be loaded. please use the wordpress importer and import the XML file that is located in your themes folder manually. :(</div>";
                exit();
            }else{
                if ( class_exists( 'WP_Import' ))
                {
                    include_once( QVA_ADMIN_MD . 'import-demo/class.import-demo-data.php');
                }
                if(!is_file( QVA_DEFS . 'demo_data.xml')){
                    echo "<div class=\"alert-box alert-error\"><strong>Error!</strong> The XML file containing the dummy content is not available or could not be read .. You might want to try to set the file permission to chmod 755.<br/>If this doesn't work please use the wordpress importer and import the XML file (should be located in your download .zip: Sample Content folder) manually :(</div>";
                    exit();
                }
                else{

                    $wp_import = new WilokeImport($this->adefConfigs);

                    $wp_import->fetch_attachments = true;
                    $wp_import->remove_all_posts();
                    $wp_import->import( QVA_DEFS . 'demo_data.xml');
                    $wp_import->update_theme_options();
                    $wp_import->set_widgets();
                    $wp_import->set_static_page();
                    $wp_import->set_menus();
                }

                echo "<div class=\"alert-box alert-success\"><strong>Success!</strong> Import Demo Ok :))</div>";
            }
        }else{
            echo '<div class="alert-box alert-error">Opp! Import Error:(</div>';
        }

        die();
        }

        public function qva_latest_tweets()
        {

            $data = get_option('widget_qva_lastest_twitter');

            $data = $data[2];

            $consumer_key     = isset($data['tweet_consemmer_key']) ?  $data['tweet_consemmer_key'] : '';
            $consumer_secret  = isset($data['tweet_consemmer_secret']) ?  $data['tweet_consemmer_secret'] : '';
            $user_token       = isset($data['tweet_access_token']) ?  $data['tweet_access_token'] : '';
            $user_secret      = isset($data['tweet_secret_access_token']) ?  $data['tweet_secret_access_token'] : '';

            $twData           = array('consumer_key'=>$consumer_key, 'consumer_secret'=>$consumer_secret, 'user_token'=>$user_token, 'user_secret'=>$user_secret);

            include (QVA_ADMIN_LIBS . 'twitter-feed/twitter.php');
            $ezTweet = new ezTweet($twData);
            $ezTweet->fetch();
     

            die();
        }


        public function qva_create_sidebar()
        {
            include(QVA_ADMIN_DIR . '/modules/widgets/sidebar.php');
        }



        public function qva_show_menu_config_box()
        {
            include (QVA_ADMIN_DIR . '/modules/metaboxes/menu/menu-config-box.php');
        }

        public function qva_add_options()
        {
            include (QVA_ADMIN_DIR . '/modules/metaboxes/post/add-options.php');
        }

        public function qva_get_options()
        {
            return self::$qvaOptions = get_option("qva_save_theme_options");
        }

        /*
         * Filter Gallery
         */
        public function  qva_override_gallery_column($empty, $attr){
            //Extract the attributes
            //Create your own gallery layout
            return $output;
        }

        /*
         * theme options
         */
        public function qva_add_theme_options()
        {

        }



        public function  test()
        {
        }


        /*
         * Insert customf field data
         */

        public function qva_insert_custom_field_data($post, $attachments)
        {

            if ( isset($attachments['qva_insert_link'] ) )
            {
                update_post_meta($post['ID'], 'qva_insert_link', $attachments['qva_insert_link']);
            }

            return $post;
        }

        /*
         * custom attachment fields
         */
        public function qva_custom_attachment_fields( $fields, $post )
        {
            $insertLink = get_post_meta($post->ID, 'qva_insert_link', true);

            $fields['qva_insert_link'] = array(
                'label' => 'Insert Link',
                'input' => 'text',
                'value' => $insertLink,
                'show_in_edit' => true,
            );
            return $fields;
        }



        /*
         * Filter for gallery shortcode
         */
        public function qva_filter_for_gallery_shortcode($output, $attr)
        {
            $file = QVA_ADMIN_DIR . '/modules/filter-gallery-shortcode/filter-gallery-shortcode.php';

            if ( !file_exists($file) )
            {
                var_dump('File does not exist' . __LINE__);
            }else{
                include ($file);
            }
        }

        /*
         * Frontend loading js css
         */
        public function qva_fe_enqueue_scripts()
        {
            wp_register_style('lightbox', QVA_FE_CSS . 'lightbox.min.css', array(), QVA_VERSION);
            wp_register_style('custom-color', get_template_directory_uri() . '/assets/colors/red.css', array(), QVA_VERSION);
            wp_register_style('bootstrap', QVA_FE_CSS . 'bootstrap.css', array(), '3.0.2');
            wp_register_style('jquery-ui', QVA_FE_CSS . 'jquery-ui-1.8.16.custom.css', array(), '1.8.16');
            wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', array(), '4.0.3');
            wp_register_style('google-font', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,600,700,800,300', array(), QVA_VERSION);
            wp_register_style('custom-style', QVA_FE_CSS . 'style.css', array(), QVA_VERSION);
            wp_register_style('mbYT-style', QVA_FE_CSS . 'mb.YTVPlayer.css', array(), '1.4');
            wp_register_style('bx-sliderstyle', QVA_FE_CSS . 'jquery.bxslider.css', array(), '4.0');

            wp_enqueue_style('google-font');
           
            wp_enqueue_style('bootstrap');

            wp_enqueue_style('font-awesome');
            wp_enqueue_style('custom-style');
            wp_enqueue_style('custom-color');
            wp_enqueue_style('jquery-ui');

            if (  qva_is_static_page()  ) :
                wp_enqueue_style('mbYT-style');
                wp_enqueue_style('lightbox');
            endif;

            wp_enqueue_style('bx-sliderstyle');


            wp_register_script('conditionizr', QVA_FE_JS . 'conditionizr-4.3.0.min.js', array(), '4.3.0'); // Conditionizr
            wp_register_script('jquery-for-youtube', QVA_FE_JS . 'jquery.mb.YTPlayer.js', array(), '1.4.0');
            wp_register_script('bootstrap', QVA_FE_JS . 'bootstrap.js',array(), QVA_VERSION);
            wp_register_script('widget-ui', QVA_FE_JS . 'jquery.ui.widget.min.js',array(), QVA_VERSION);
            // wp_register_script('contact', QVA_FE_JS . 'jquery.contact.js',array(), QVA_VERSION);
            wp_register_script('countTo', QVA_FE_JS . 'jquery.countTo.js',array(), QVA_VERSION);
            wp_register_script('easing', QVA_FE_JS . 'jquery.easing.js',array(), QVA_VERSION);
            wp_register_script('flexslider', QVA_FE_JS . 'jquery.flexslider.js',array(), QVA_VERSION);
            wp_register_script('isotope', QVA_FE_JS . 'jquery.isotope.js',array(), QVA_VERSION);
            wp_register_script('placeholder', QVA_FE_JS . 'jquery.placeholder.js',array(), QVA_VERSION);  
            wp_register_script('superslides', QVA_FE_JS . 'jquery.superslides.js',array(), QVA_VERSION);
            wp_register_script('rlightbox', QVA_FE_JS . 'jquery.ui.rlightbox.js',array(), QVA_VERSION);
            wp_register_script('modernizr.custom.26633', QVA_FE_JS . 'modernizr.custom.26633.js',array(), QVA_VERSION);
            wp_register_script('custom-nav-menu', QVA_FE_JS . 'jquery.custom-nav.js',array(), QVA_VERSION);
            wp_register_script('slideroption', QVA_FE_JS . 'slideroption.js',array(), QVA_VERSION);
            wp_register_script('stickUp', QVA_FE_JS . 'stickUp.js',array(), QVA_VERSION);
            wp_register_script('wo-custom-js', QVA_FE_JS . 'jquery.wo-custom.js',array(), QVA_VERSION, true);
            wp_register_script('qva-custom', QVA_FE_JS . 'custom.js', array(), QVA_VERSION); 
            wp_register_script('query-meta-data', QVA_FE_JS . 'jquery.metadata.js', array(), QVA_VERSION);
            wp_register_script('bxslider', QVA_FE_JS . 'jquery.bxslider.min.js', array(), QVA_VERSION);
            wp_register_script('jflickrfeed', QVA_FE_JS . 'jflickrfeed.min.js', array(), QVA_VERSION);
            wp_register_script('qva-twittermod', QVA_FE_JS . 'jquery.tweets.js', array(), QVA_VERSION);
            wp_register_script('qva-googlemap', 'https://maps.google.com/maps/api/js?sensor=false', array());
           
            wp_enqueue_script('modernizr.custom.26633');

            wp_enqueue_script('jquery');
            
            
           
            
            wp_enqueue_script('widget-ui');
            
            // wp_enqueue_script('jquery-ui-mouse');
            // wp_enqueue_script('rlightbox');
            wp_enqueue_script('countTo');
            wp_enqueue_script('conditionizr'); // Enqueue it!
            wp_enqueue_script('bootstrap');
            wp_enqueue_script('placeholder');

            if ( qva_is_static_page()  ):
                // var_dump('expression');
                wp_enqueue_script('stickUp');
                wp_enqueue_script('custom-nav-menu');
                wp_enqueue_script('rlightbox');
                wp_enqueue_script('isotope');
                wp_enqueue_script('qva-googlemap');
                wp_enqueue_script('flexslider');
                wp_enqueue_script('superslides');
                // wp_enqueue_script('query-meta-data');
                wp_enqueue_script('jquery-for-youtube');
            else :
                wp_enqueue_script('bxslider');
                 // wp_enqueue_script('qva-ui-widgets');
                wp_enqueue_script('qva-twittermod');
                wp_enqueue_script('jflickrfeed'); 
            endif;

            wp_enqueue_script('jquery-ui-mouse');

            // wp_enqueue_script('jquery-ui-widgets');
            // wp_enqueue_script('contact');
            wp_enqueue_script('easing');
            

            
            
            
            wp_enqueue_script('slideroption');

            wp_enqueue_script('wo-custom-js');
            wp_enqueue_script('qva-custom');

            $colorScheme = isset(self::$qvaOptions['design']['color_scheme']) ? qvaCore::$qvaOptions['design']['color_scheme']  : 'yellow';

            switch ($colorScheme) {
                case 'red':
                    $fileName = 'red.css';
                    break;
                case 'green':
                    $fileName = 'green.css';
                    break;
                case 'blue':
                    $fileName = 'blue.css';
                    break;
                case 'orange':
                    $fileName = 'orange.css';
                    break;
                case 'purple':
                    $fileName = 'purple.css';
                    break;
                
                default:
                    $fileName = 'yellow.css';
                    break;
            }

            wp_register_style('wo-custom-css', QVA_FE_CUSTOM_COLOR . $fileName, array(), '1.0' );
            wp_enqueue_style('wo-custom-css');

            wp_localize_script('qva-custom', 'WILOKE', array('ajaxurl'=>admin_url('admin-ajax.php')));
        }



        /*
         * Header cache
         */
        public function wo_header_cache()
        {

        }

        /*
         * Save Posts
         */
        public function qva_save_posts($post_id)
        {
            if (!current_user_can('edit_post', $post_id) || !isset($_POST['post_type'])) return;

            $postType = $_POST['post_type'];

            $aAllow   = array('qva_ourteam', 'qva_ourservice', 'qva_aboutus', 'qva_ourclients', 'qva_contact_details', 'post', 'qva_ourwork');

            if (!in_array($postType, $aAllow)) return;

            if ($postType == 'post')
            {
                $postType = 'custompost';
                $_POST = $_POST['custompost'];
            }

            $data = $this->qva_unslashed_before_update($_POST);

            update_post_meta($post_id, $postType, $data);

        }

        public function qva_unslashed_before_update($input)
        {   
           if ( is_array($input) ) 
           {
                array_map( array($this, "qva_unslashed_before_update") , $input);
           }else{
                wp_unslash($input);
           }

           return $input;
        }


        /*
         * Add table fa
         */
        public function qva_add_table_fa()
        {
            $file = QVA_ADMIN_DIR . '/modules/popup/table-fa.php';

            if (!file_exists($file))
            {
                var_export('File does not exist!');
            }else{
                 include ($file);
            }
        }



        /*
         * Flush rewrite rules
         */
        public function qva_flush_rewrite_rules()
        {
            flush_rewrite_rules();
        }


        /*
         * Register Post Type
         */
        public function qva_register_post_type()
        {

            if (file_exists(QVA_ADMIN_DIR . '/modules/register-post-type/wo.register-post-type.tpl.php'))
            {
                include (QVA_ADMIN_DIR . '/modules/register-post-type/wo.register-post-type.tpl.php');

                /* processing register post type and taxonomy */

                foreach ($aPostType as $k => $v)
                {
                    register_post_type($k, $v);
                }

                foreach ($aTax as $k => $v)
                {
                    register_taxonomy($k, $v['post_type'], $v['args']);
                }

            }else{
                echo 'Have error on the line' . __LINE__;
            }
        }


        /*
         * Enqueue Scripts
         */
        public function qva_enqueue_scripts()
        {
            global $post, $typenow;

            $screen = get_current_screen();

            wp_enqueue_media();
            wp_enqueue_style('wp-color-picker');

            wp_register_style('qva-reset-css', QVA_ADMIN_CSS_URI . 'reset.css', array(), QVA_VERSION);
            wp_register_style('qva-style-fa', QVA_ADMIN_CSS_URI . 'style.fa.css', array(), QVA_VERSION);
            wp_register_style('qva-admin-css', QVA_ADMIN_CSS_URI . 'style.admin.css', array(), QVA_VERSION);
            wp_register_style('qva-pretty-css', QVA_ADMIN_CSS_URI . 'grid.css', array(), QVA_VERSION);
            // wp_register_style('qva-reset-css', QVA_ADMIN_CSS_URI . 'reset.css', array(), QVA_VERSION);
            // wp_register_style('qva-thickbox-css', QVA_ADMIN_CSS_URI . 'reset.css', array(), QVA_VERSION);
            wp_register_style('qva-font_awesome-css', 'http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css', array(), '4.1.0');
            wp_register_style('qva-ourteam-css', QVA_ADMIN_CSS_URI . 'style.ourteam.css', array(), QVA_VERSION);
            wp_register_style('qva-ourclients-css', QVA_ADMIN_CSS_URI . 'style.other.css', array(), QVA_VERSION);
            wp_register_style('qva-ourservice-css', QVA_ADMIN_CSS_URI . 'style.ourservice.css', array(), QVA_VERSION);
            wp_enqueue_style('qva-reset-css');
            wp_enqueue_style('qva-style-fa');
            wp_enqueue_style('qva-pretty-css');
            wp_enqueue_style('qva-admin-css');

            wp_enqueue_style('thickbox');
            if ($typenow == 'qva_ourteam' || $typenow=='qva_contact_details' || $typenow =='qva_ourservice' || $typenow=='qva_aboutus' || $typenow=='qva_ourclients' || $typenow == 'qva_ourwork') : 
               wp_enqueue_style('qva-font_awesome-css');
               
            endif;

            if ( $screen->base == "toplevel_page_qva-options" )
            {
                wp_enqueue_style('qva-font_awesome-css');
            }

            if ($typenow == 'qva_ourclients') : 
                wp_enqueue_style('qva-ourclients-css');
            endif;

          

            if ($typenow=='qva_ourteam'):
                wp_enqueue_style('qva-ourteam-css');
            endif;

            if ($typenow == 'qva_ourservice' || $typenow=='qva_contact_details' || $typenow=='qva_aboutus') : 
                wp_enqueue_style('qva-ourservice-css');
            endif;

            wp_register_style('qva-reset-css', QVA_ADMIN_CSS_URI . 'reset.css', array(), QVA_VERSION);



            wp_enqueue_script('jquery');
            wp_enqueue_script('thickbox');
            wp_enqueue_script('jquery-form');
            wp_enqueue_script('wp-color-picker');

            wp_register_script('qva-custom-all', QVA_ADMIN_JS_URI . 'jquery.custom.js', array(), QVA_VERSION);
            wp_enqueue_script('qva-custom-all');

            wp_register_script('qva-menu', QVA_ADMIN_JS_URI . 'jquery.qva-menu.js', array(), QVA_VERSION);

 
            if ($screen->base=='nav-menus')
            {
                wp_enqueue_script('qva-menu');
            }


            wp_register_script('wo-blank-js', get_template_directory_uri() . '/admin/assets/js/jquery.blank.js', array(), '1.0');
            wp_enqueue_script('wo-blank-js');

            if ( $screen->base=='theme-options_page_import-demo-qva' ) :
                wp_register_script('wo-jquery-upload', get_template_directory_uri() . '/admin/assets/js/jquery.import-demo.js', array(), '1.0');
                wp_enqueue_script('wo-jquery-upload');
            endif;

            wp_localize_script('wo-blank-js', 'WO_QVA', array('placeholder'=>get_template_directory_uri() . '/admin/assets/images/addpeople.png'));

            wp_localize_script('wo-blank-js', 'WO_QVA', array('logo'=>get_template_directory_uri() . '/admin/assets/images/no-img_150x150.jpg'));

            

        }


        /*
         * settings meta box
         */
        public function qva_edit_form_after_title()
        {
            global $post;

            if ( !empty($post) ) :

                switch ($post->post_type)
                {
                    case 'qva_ourteam':
                        include (QVA_ADMIN_DIR . '/modules/metaboxes/ourteam/ourteam.php');
                        break;

                    case 'qva_ourservice':
                        // include (WO_ADMIN_DIR . '/modules/metaboxes/ourservice/ourservice.php');
                        break;

                    case 'qva_aboutus' :
                        // include (WO_ADMIN_DIR . '/modules/metaboxes/aboutus/aboutus.php');
                        break;

                    case 'qva_testimonial':
                        // include (WO_ADMIN_DIR . '/modules/metaboxes/testimonial/testimonial.php');
                        break;

                    case 'qva_ourassets':
                        // include (WO_ADMIN_DIR . '/modules/metaboxes/ourassets/ourassets.php');
                        break;


                    case 'qva_ourclients':
                        // include (WO_ADMIN_DIR . '/modules/metaboxes/ourclients/ourclients.php');
                        break;

                    case 'qva_contact_details':
                        include (QVA_ADMIN_DIR . '/modules/metaboxes/contact-details/contact-details.php');
                        break;

                    case 'qva_ourwork':
                        include(QVA_ADMIN_DIR . '/modules/metaboxes/ourwork/ourwork.php');
                        break;
                }

            endif;
        }
    }

    qvaCore::qva_automaticallyThis($aDefaults);

    // create qva menu
    include (QVA_ADMIN_DIR . '/modules/metaboxes/menu/menu-config-box.php');
}else{
    var_dump('Class is available!');
}